package com.h3c.nem.controller;


import com.eos.common.constant.StatusCodeEnum;
import com.eos.common.util.Result;
import com.h3c.nem.entity.EducationInfo;
import com.h3c.nem.entity.QualificationInfo;
import com.h3c.nem.service.EducationInfoService;
import com.h3c.nem.vo.EducationVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @Author wys45664
 * @Creat 2023/10/10 16:31
 */
@Slf4j
@RestController
@RequestMapping("/educationInfo")
@CrossOrigin
@RequiredArgsConstructor
@Api(tags = "学历、学位OCR差异分析")
public class EducationInfoController {
 private final EducationInfoService educationInfoService;
 @PostMapping("/importCheckEducationInfo")
 @ApiOperation("学位证差异分析")
 public Result checkEducationInfo(@RequestParam("file") MultipartFile file,@RequestBody EducationInfo educationInfo) throws IOException {
  EducationVO educationVO = educationInfoService.checkEducationInfo(educationInfo,file);
  return new Result(true, StatusCodeEnum.SEARCH_SUCCESS, educationVO);
 }
 @PostMapping("importCheckQualificationInfo")
 @ApiOperation("学历证差异分析")
 public Result checkQualificationInfo(@RequestParam("file") MultipartFile file,@RequestBody QualificationInfo qualificationInfo) throws IOException {
  EducationVO educationVO = educationInfoService.checkQualificationInfo(qualificationInfo, file);
  return new Result(true, StatusCodeEnum.SEARCH_SUCCESS, educationVO);
 }
}
